<script>
    function handleDate(arr, Ture = true) {
        sum = 0
        for (i = 0; i < arr.length; i++)
            sum += arr[i]
        if (Ture)
            alert(sum)
        else
            alert(sum / arr.length)
    }
    handleDate([1, 1])
    handleDate([1, 1], false)
</script>